<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>表管理</title>
    <link rel="stylesheet" href="/bus/js/css/layui.css" media="all">
    <style>
        body {
            margin: 10px;
        }
        .my-inline2 {
            width: 200px
        }
        .my-inline3 {
            width: 150px
        }

    </style>
</head>
<body>
<forms class="layui-form">
    <div class="searchTable">
        搜索：
        <div class="layui-inline my-inline3">
            <input class="layui-input" name="tableName" id="tableName" placeholder="表名称" autocomplete="off">
        </div>

        <div class="layui-inline my-inline3">
            <input class="layui-input" name="tableComment" id="tableComment" placeholder="表描述" autocomplete="off">
        </div>


        <div class="layui-inline my-inline2" hidden="hidden" id="datasourceView">
            <select name="datasourceId" lay-search="" id="datasourceId" lay-filter="datasourceId">
                <!--            <option value="1" selected></option>-->
                <option th:selected="${userStat.index == 0} ? 'true' : 'false'"
                        th:each="Module,userStat:${datasourceConfigs}" th:value="${Module.id}"
                        th:text="${Module.host+'::'+Module.dbName}">name
                </option>

            </select>
        </div>

        <div class="layui-inline my-inline">
            <select name="needFresh" lay-search="" id="needFresh" lay-filter="needFresh">
                <option value="-1" selected>使用缓存信息</option>
                <option value="1">刷新数据库表</option>
            </select>
        </div>

        <div class="layui-inline my-inline">
            <select name="isUp" lay-search="" id="isUp" lay-filter="isUp">
                <option value="1" selected>已导入</option>
                <option value="-1">未导入</option>
            </select>
        </div>


        <button class="layui-btn mySubmitBtn" lay-filter="submitBtn2" id="submitBtn2" data-type="reload">搜索</button>


    </div>
</forms>
<table class="layui-hide" id="demo" lay-filter="test"></table>

<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
<!--    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="previewCodeByOnline">在线模板</a>-->
    <!--    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="getCodeo">代码生成o</a>-->
    <!--    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="getCode">代码生成</a>-->
    <a class="layui-btn layui-btn-xs" lay-event="more">更多 <i class="layui-icon layui-icon-down"></i></a>
</script>

<script type="text/html" id="toolbarDemo">
    <div className="layui-btn-container">
        <button class="layui-btn layui-btn-sm" lay-event="addSource">新增数据源</button>
        <button class="layui-btn layui-btn-sm" id="dataSourceList">
            数据源
        </button>
        <button class="layui-btn layui-btn-sm" lay-event="codeGenList">后台生成</button>
        <button class="layui-btn layui-btn-sm" lay-event="codeGenListo" style="background-color: #DD691D"> 代码生成</button>
    </div>
</script>

<script type="text/html" id="gidTemplate">
    <select class="selectFieldTypeClass" name="gid" value="{{d.gid}}" title="模板组" lay-filter="gid"
            data-value="{{d.gid}}">
        <option th:each="tg : ${templateGroups}" th:value="${tg.id}" th:text="${tg.groupName}"></option>
    </select>
</script>


<script src="/bus/js/layui.js"></script>
<script src="/bus/common.js"></script>
<script src="/bus/listTable.js"></script>
<script>
    form.on('select(gid)', function (obj) {
        var elem = $(obj.elem);
        var trElem = elem.parents('tr');
        var tableData = table.cache['testReload'];
        var tableId = tableData[trElem.data('index')]['id'];
        var selectValue = elem.val();

        var updateTableData = {
            "gid":selectValue
        };

        if(tableId==null){
            layer.msg("没有导入，无法操作");
            return;
        }
        commonUtil.sendRequest("PUT", updateTableData,   "/gentable/"+tableId);

    });

</script>
</body>
</html>
